package com.ruoyi.system.domain;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseIdEntity;
import com.ruoyi.common.utils.StringUtils;
import lombok.Data;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;

/**
 * 员工记录对象 s_user_operate_record
 * 
 * @author ruoyi
 * @date 2023-07-05
 */
@Data
@ApiModel(value = "SUserOperateRecord", description = "员工记录对象")
public class SUserOperateRecord extends BaseIdEntity
{
    private static final long serialVersionUID = 1L;

    /** id */
    @ApiModelProperty("id")
    private String id;

    /** 变电站设备id */
    @Excel(name = "变电站设备id")
    @ApiModelProperty("变电站设备id")
    private String deviceId;

    /** 保护装置id */
    @Excel(name = "保护装置id")
    @ApiModelProperty("保护装置id")
    private String protectDeviceId;

    /** 用户id */
    @Excel(name = "用户id")
    @ApiModelProperty("用户id")
    private String userId;

    /** 签名图片地址 */
    @Excel(name = "签名图片地址")
    @ApiModelProperty("签名图片地址")
    private String signUrl;

    /** 提交时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "提交时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("提交时间")
    private Date submitTime;

    /** 设备名称 */
    @TableField(exist = false)
    @ApiModelProperty("设备名称")
    private String deviceName;

    /** 员工姓名 */
    @TableField(exist = false)
    @ApiModelProperty("员工姓名")
    private String nickName;

    /** 变电站名称 */
    @TableField(exist = false)
    @ApiModelProperty("变电站名称")
    private String substationName;

    /** 保护型号 */
    @TableField(exist = false)
    @ApiModelProperty("保护型号")
    private String protectDeviceModel;



    /** 创建者 */
    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty("创建者")
    private String createBy;

    /** 创建时间 */
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 更新者 */
    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty("更新者")
    private String updateBy;

    /** 更新时间 */
    @ApiModelProperty("更新时间")
    @TableField(fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    public <T> QueryWrapper<T> queryWrapper(){
        QueryWrapper<T> wrapper=new QueryWrapper<>();

        wrapper.eq(StringUtils.isNotEmpty(id),"id" , id);
        wrapper.eq(StringUtils.isNotEmpty(deviceId),"device_id" , deviceId);
        wrapper.eq(StringUtils.isNotEmpty(protectDeviceId),"protect_device_id" , protectDeviceId);
        wrapper.eq(StringUtils.isNotEmpty(userId),"user_id" , userId);
        wrapper.like(StringUtils.isNotEmpty(signUrl),"sign_url" , signUrl);
        wrapper.orderByDesc("create_time");
        return wrapper;
    }

}
